package main.java.maziacs.characters;

import main.java.maziacs.ITile;
import main.java.maziacs.squares.ISquare;


public class Position {

	public Position(ITile t, ISquare s){
		if(t.equals(null) || s.equals(null))
			throw new NullPointerException();//TODO


		setTile(t);
		setSquare(s);
	}

	/**
	 * @uml.property  name="tile"
	 */
	private ITile tile;

	/**
	 * Getter of the property <tt>tile</tt>
	 * @return  Returns the tile.
	 * @uml.property  name="tile"
	 */
	public ITile getTile() {
		return tile;
	}

	/**
	 * Setter of the property <tt>tile</tt>
	 * @param tile  The tile to set.
	 * @uml.property  name="tile"
	 */
	public void setTile(ITile tile) {
		this.tile = tile;
	}

	/**
	 * @uml.property  name="square"
	 */
	private ISquare square;

	/**
	 * Getter of the property <tt>square</tt>
	 * @return  Returns the square.
	 * @uml.property  name="square"
	 */
	public ISquare getSquare() {
		return square;
	}

	/**
	 * Setter of the property <tt>square</tt>
	 * @param square  The square to set.
	 * @uml.property  name="square"
	 */
	public void setSquare(ISquare square) {
		this.square = square;
	}

		
	/**
	 */
	public boolean isValidPosition(){
		Boolean isOnBoard=tile.getBoard().getTilesOnBoard().contains(tile);
		Boolean isValid=square.getPositionI()>=0 && square.getPositionI()<3 
			&& square.getPositionJ()>=0 && square.getPositionJ()<3;
		return isOnBoard && isValid;	
	}
}
